Skip to main content

All Questions

Tagged with
1vote
1answer
93views

Checking whether a graph is connected in an immutable way

I have this function at the moment ...
bigfocalchord's user avatar
1vote
1answer
123views

Scala graph coloring

i have solved this problem https://leetcode.com/problems/find-eventual-safe-states/submissions/ ...
nz_21's user avatar
  • 1,051
9votes
1answer
604views

Kattis problem Amanda Lounges

I wrote this solution to Kattis problem Amanda Lounges in Scala. The code is written to solve a graph theory problem where it will read in a list of edges from stdin and try to compute the minimum ...
Brian McCutchon's user avatar
1vote
1answer
587views

Print Connected Components Scala

Given a file containing adjacent IDs: i1, i2, i5 i3, i4 i2, i6, i7 i4, i8 i9, i3 I would like to print each of the connected components: ...
evan.oman's user avatar
1vote
1answer
569views

Convert a List of graph edges to a Map of neighboring nodes

What would be best way achieving this? Is it possible to use Immutable map? ...
Ski's user avatar
  • 265
12votes
3answers
477views

Kosaraju in Scala

I started coding in Scala some time ago, and also learning some fundamental algorithms in CS. Here's a terribly slow implementation of Kosaraju algorithm to find strongly connected components in a ...
Bacon's user avatar
2votes
1answer
2kviews

Graphs processing in Scala

I've just started to learn Scala and decided to implement small graph library to train. Here is the basic version, that describes graph and nodes structure and also provides implementation of ...
mkrakhin's user avatar
6votes
1answer
1kviews

Dijkstra-like routing algorithm

I've got the following code to find the shortest path between two nodes using almost-Dijkstra's-algorithm which was written for an exercise, and I'm looking for things to improve my general Scala ...
Martijn's user avatar
11votes
1answer
17kviews

BFS and DFS in Scala

I would love it if someone could give me some suggestions for these 2 graph search functions. I am new to scala and would love to get some insight into making these more idiomatic. ...
JPC's user avatar
  • 375
1vote
1answer
145views

Small graph API to track vertices and edges added to graph

I'm working on my Scala chops and implemented a small graph API to track vertices and edges added to graph. I have basic GraphLike Trait, and have an Undirected Graph class ( ...
Kartik Aiyer's user avatar
4votes
1answer
398views

Finding and returning a loopy path in a directed graph

I wrote a function in Scala to find out and return a loopy path in a directed graph. One of the arguments is a graph presented in an adjacent list, and the other is a start node. It returns a pair ...
Qi Qi's user avatar

close